import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _regeneratorRuntime from "@babel/runtime/regenerator";

/**
 * authorityDimension.js -  model
 * @date: 2019-9-23
 */
import { getResponse } from 'utils/utils';
import { queryUserAuthorityData as _queryUserAuthorityData, addUserAuthorityData as _addUserAuthorityData, deleteUserAuthorityData as _deleteUserAuthorityData, queryRoleAuthorityData as _queryRoleAuthorityData, addRoleAuthorityData as _addRoleAuthorityData, deleteRoleAuthorityData as _deleteRoleAuthorityData } from "../services/authorityDimensionService";
import { queryData } from "../services/roleManagementService";
import { queryData as queryAccountData } from "../services/subAccountOrgService";
export default {
  namespace: 'authorityDimension',
  state: {},
  effects: {
    queryUserAuthorityData: /*#__PURE__*/_regeneratorRuntime.mark(function queryUserAuthorityData(_ref, _ref2) {
      var payload, call, res;
      return _regeneratorRuntime.wrap(function queryUserAuthorityData$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              payload = _ref.payload;
              call = _ref2.call;
              _context.next = 4;
              return call(_queryUserAuthorityData, payload);

            case 4:
              res = _context.sent;
              return _context.abrupt("return", getResponse(res));

            case 6:
            case "end":
              return _context.stop();
          }
        }
      }, queryUserAuthorityData);
    }),
    addUserAuthorityData: /*#__PURE__*/_regeneratorRuntime.mark(function addUserAuthorityData(_ref3, _ref4) {
      var payload, call, res;
      return _regeneratorRuntime.wrap(function addUserAuthorityData$(_context2) {
        while (1) {
          switch (_context2.prev = _context2.next) {
            case 0:
              payload = _ref3.payload;
              call = _ref4.call;
              _context2.next = 4;
              return call(_addUserAuthorityData, payload);

            case 4:
              res = _context2.sent;
              return _context2.abrupt("return", getResponse(res));

            case 6:
            case "end":
              return _context2.stop();
          }
        }
      }, addUserAuthorityData);
    }),
    deleteUserAuthorityData: /*#__PURE__*/_regeneratorRuntime.mark(function deleteUserAuthorityData(_ref5, _ref6) {
      var payload, call, res;
      return _regeneratorRuntime.wrap(function deleteUserAuthorityData$(_context3) {
        while (1) {
          switch (_context3.prev = _context3.next) {
            case 0:
              payload = _ref5.payload;
              call = _ref6.call;
              _context3.next = 4;
              return call(_deleteUserAuthorityData, payload);

            case 4:
              res = _context3.sent;
              return _context3.abrupt("return", getResponse(res));

            case 6:
            case "end":
              return _context3.stop();
          }
        }
      }, deleteUserAuthorityData);
    }),
    queryRoleAuthorityData: /*#__PURE__*/_regeneratorRuntime.mark(function queryRoleAuthorityData(_ref7, _ref8) {
      var payload, call, res;
      return _regeneratorRuntime.wrap(function queryRoleAuthorityData$(_context4) {
        while (1) {
          switch (_context4.prev = _context4.next) {
            case 0:
              payload = _ref7.payload;
              call = _ref8.call;
              _context4.next = 4;
              return call(_queryRoleAuthorityData, payload);

            case 4:
              res = _context4.sent;
              return _context4.abrupt("return", getResponse(res));

            case 6:
            case "end":
              return _context4.stop();
          }
        }
      }, queryRoleAuthorityData);
    }),
    addRoleAuthorityData: /*#__PURE__*/_regeneratorRuntime.mark(function addRoleAuthorityData(_ref9, _ref10) {
      var payload, call, res;
      return _regeneratorRuntime.wrap(function addRoleAuthorityData$(_context5) {
        while (1) {
          switch (_context5.prev = _context5.next) {
            case 0:
              payload = _ref9.payload;
              call = _ref10.call;
              _context5.next = 4;
              return call(_addRoleAuthorityData, payload);

            case 4:
              res = _context5.sent;
              return _context5.abrupt("return", getResponse(res));

            case 6:
            case "end":
              return _context5.stop();
          }
        }
      }, addRoleAuthorityData);
    }),
    deleteRoleAuthorityData: /*#__PURE__*/_regeneratorRuntime.mark(function deleteRoleAuthorityData(_ref11, _ref12) {
      var payload, call, res;
      return _regeneratorRuntime.wrap(function deleteRoleAuthorityData$(_context6) {
        while (1) {
          switch (_context6.prev = _context6.next) {
            case 0:
              payload = _ref11.payload;
              call = _ref12.call;
              _context6.next = 4;
              return call(_deleteRoleAuthorityData, payload);

            case 4:
              res = _context6.sent;
              return _context6.abrupt("return", getResponse(res));

            case 6:
            case "end":
              return _context6.stop();
          }
        }
      }, deleteRoleAuthorityData);
    }),
    querySecGrpAuthorityData: /*#__PURE__*/_regeneratorRuntime.mark(function querySecGrpAuthorityData(_ref13, _ref14) {
      var payload, call, res;
      return _regeneratorRuntime.wrap(function querySecGrpAuthorityData$(_context7) {
        while (1) {
          switch (_context7.prev = _context7.next) {
            case 0:
              payload = _ref13.payload;
              call = _ref14.call;
              _context7.next = 4;
              return call(queryData, payload);

            case 4:
              res = _context7.sent;
              return _context7.abrupt("return", getResponse(res));

            case 6:
            case "end":
              return _context7.stop();
          }
        }
      }, querySecGrpAuthorityData);
    }),
    queryAccountSecGrpAuthorityData: /*#__PURE__*/_regeneratorRuntime.mark(function queryAccountSecGrpAuthorityData(_ref15, _ref16) {
      var payload, call, res;
      return _regeneratorRuntime.wrap(function queryAccountSecGrpAuthorityData$(_context8) {
        while (1) {
          switch (_context8.prev = _context8.next) {
            case 0:
              payload = _ref15.payload;
              call = _ref16.call;
              _context8.next = 4;
              return call(queryAccountData, payload);

            case 4:
              res = _context8.sent;
              return _context8.abrupt("return", getResponse(res));

            case 6:
            case "end":
              return _context8.stop();
          }
        }
      }, queryAccountSecGrpAuthorityData);
    })
  },
  reducers: {
    updateState: function updateState(state, _ref17) {
      var payload = _ref17.payload;
      return _objectSpread(_objectSpread({}, state), payload);
    }
  }
};